/*   Copyright © 2009 Mark Gil Torres
 *
 *   This file is part of mtoolkit.
 *
 *   mtoolkit is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   any later version.
 *
 *   mtoolkit is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with mtoolkit.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef MTA_ZFUNCTIONS_HPP
#define MTA_ZFUNCTIONS_HPP

#include <iostream>
#include <stack>

#include "../include/integer.h"
#include "variant.hpp"
#include <boost/lexical_cast.hpp>

using namespace mt;
using namespace std;

/*
struct gcdZ {
  gcdZ(stack<Variant>& inStack) : myStack(inStack) {}

  void operator()(char const* str, char const* end) const {
    Variant x, y, z ;
    Integer a, b, c;
    x = myStack.top();
    a = x.getZValue();
    myStack.pop();
    y = myStack.top();
    b = y.getZValue();
    myStack.pop();
    c = gcd(b,a);
    z.setZValue(c);
    myStack.push(z);
    cout<<": "<<c<<endl;
  }
  stack<Variant>& myStack;
};

struct lcmZ {
  lcmZ(stack<Variant>& inStack) : myStack(inStack) {}

  void operator()(char const* str, char const* end) const {
    Variant x, y, z ;
    Integer a, b, c;
    x = myStack.top();
    a = x.getZValue();
    myStack.pop();
    y = myStack.top();
    b = y.getZValue();
    myStack.pop();
    c = lcm(b,a);
    z.setZValue(c);
    myStack.push(z);
    cout<<": "<<c<<endl;
  }
  stack<Variant>& myStack;
};

struct powZ {
  powZ(stack<Variant>& inStack) : myStack(inStack) {}

  void operator()(char const* str, char const* end) const {
    Variant x, y, z ;
    Integer b, c;
    int a;
    x = myStack.top();
    a = x.getIValue();
    myStack.pop();
    y = myStack.top();
    b = y.getZValue();
    myStack.pop();
    c = pow(b,boost::lexical_cast<int>(a));
    z.setZValue(c);
    myStack.push(z);
    cout<<": "<<c<<endl;
  }
  stack<Variant>& myStack;
};
*/

#endif
